Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor terminal display #7339

Merged
merged 48 commits into from
Apr 12, 2024
Merged

feat: refactor terminal display #7339

merged 48 commits into from
Apr 12, 2024

Conversation

lukekarrys
Copy link
Contributor

@lukekarrys lukekarrys commented Apr 4, 2024

Tracking remaining todos here:

  • Add tests for display.js (was waiting for API to be stable enough)
  • Confirm timing file message is shown to users the same as previously
  • See if control chars can be stripped only from strings after util.format
  • Make forceLog respect silent
  • Fix cross platform snapshot tests
  • fix logs in arborist test

@H4ad
Copy link
Contributor

H4ad commented Apr 6, 2024

From what I saw, this will help the initialization like my refactoring for npmlog, and looks even faster by some ms.

One thing that I noticed you didn't call the set-blocking, this is needed to not truncate logs greater than 64Kb, but this dependency introduces 3~5ms of slowdown.

@lukekarrys lukekarrys changed the title wip: remove npmlog Refactor terminal display Apr 8, 2024
lib/cli-entry.js Outdated Show resolved Hide resolved
lib/npm.js Show resolved Hide resolved
lib/utils/display.js Outdated Show resolved Hide resolved
lib/utils/format.js Outdated Show resolved Hide resolved
test/lib/npm.js Outdated Show resolved Hide resolved
lib/npm.js Show resolved Hide resolved
@lukekarrys lukekarrys marked this pull request as ready for review April 12, 2024 00:29
@lukekarrys lukekarrys requested a review from a team as a code owner April 12, 2024 00:29
Copy link
Member

@wraithgar wraithgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed this while still in draft mode, and reviewed changes as we went.

I also triple checked that we really do only need to strip C0 and C1 from strings now.

@lukekarrys lukekarrys merged commit 9622597 into latest Apr 12, 2024
81 checks passed
@lukekarrys lukekarrys deleted the lk/remove-npmlog branch April 12, 2024 20:48
@github-actions github-actions bot mentioned this pull request Apr 12, 2024
@H4ad
Copy link
Contributor

H4ad commented Apr 12, 2024

With this PR merged:

$ hyperfine --warmup 3 "./bin/npm-cli.js run empty" "~/.asdf/installs/nodejs/21.6.2/bin/node ./bin/npm-cli.js run empty"
Benchmark 1: ./bin/npm-cli.js run empty
  Time (mean ± σ):     155.1 ms ±   1.3 ms    [User: 141.4 ms, System: 46.0 ms]
  Range (min … max):   152.1 ms … 157.0 ms    19 runs
 
Benchmark 2: ~/.asdf/installs/nodejs/21.6.2/bin/node ./bin/npm-cli.js run empty
  Time (mean ± σ):      77.2 ms ±   0.7 ms    [User: 71.0 ms, System: 17.8 ms]
  Range (min … max):    75.8 ms …  79.2 ms    38 runs
 
Summary
  '~/.asdf/installs/nodejs/21.6.2/bin/node ./bin/npm-cli.js run empty' ran
    2.01 ± 0.03 times faster than './bin/npm-cli.js run empty'

Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants